<!-- BEGIN PAGE -->
<div class="page-content">

    <!-- BEGIN PAGE CONTAINER-->
    <div class="container-fluid">

        <!-- BEGIN PAGE HEADER-->
        <div class="row-fluid">

            <div class="span12">

                <!-- BEGIN PAGE TITLE & BREADCRUMB-->
                <h3 class="page-title">

                    TaskRP
                    <small>任务红包管理</small>

                </h3>

                <ul class="breadcrumb">

                    <li>
                        <i class="icon-home"></i>
                        <a ui-sref="home.index">首页</a>
                        <i class="icon-angle-right"></i>
                    </li>

                    <li><a href="#">任务红包列表</a></li>
                </ul>
            </div>

        </div>

        <div class="row-fluid">

            <div class="span12">

                <div class="portlet box grey">

                    <div class="portlet-title">
                        <div class="caption"><i class="icon-globe"></i>任务红包列表</div>
                        <div class="actions">

                            <a ng-click="addRPacket()" class="btn blue"><i class="icon-pencil"></i> 创建</a>

                        </div>
                    </div>
                    <div class="portlet-body">
                        <div id="sample_1_wrapper" class="dataTables_wrapper form-inline" role="grid">
                            <div class="row-fluid">



                            </div>
                            <table class="table table-striped table-bordered table-hover dataTable"
                                   id="sample_1"
                                   aria-describedby="sample_1_info">
                                <thead>

                                <tr role="row">
                                    <th class="sorting" role="columnheader" tabindex="0" aria-controls="sample_1" rowspan="1"
                                        colspan="1" aria-label="Username: activate to sort column ascending"
                                        style="width: 100px;">序号
                                    </th>
                                    <th class="sorting" role="columnheader" tabindex="0" aria-controls="sample_1" rowspan="1"
                                        colspan="1" aria-label="Username: activate to sort column ascending"
                                        style="width: 100px;">任务名称
                                    </th>

                                    <th class="hidden-480 sorting_disabled" role="columnheader" rowspan="1" colspan="1"
                                        aria-label="Joined">聊天室
                                    </th>
                                    <th class="hidden-480 sorting_disabled" role="columnheader" rowspan="1" colspan="1"
                                        aria-label="Joined">红包类型
                                    </th>
                                    <th class="hidden-480 sorting_disabled" role="columnheader" rowspan="1" colspan="1"
                                        aria-label="Joined">红包总金额
                                    </th>
                                    <th class="hidden-480 sorting_disabled" role="columnheader" rowspan="1" colspan="1"
                                        aria-label="Joined">
                                        红包总数
                                    </th>
                                    <th class="hidden-480 sorting_disabled" role="columnheader" rowspan="1" colspan="1"
                                        aria-label="Joined" style="text-align: center;width:80px;">时间间隔</th>
                                    <th class="hidden-480 sorting_disabled" role="columnheader" rowspan="1" colspan="1"
                                        aria-label="Joined" style="text-align: center;width:80px;">操作</th>
                                </tr>
                                </thead>


                                <tbody role="alert" aria-live="polite" aria-relevant="all" ng-if="getSysRPList.length != 0">
                                <tr class="gradeX odd"  ng-repeat="item in getSysRPList"
                                    ng-class="{'odd':$odd,'even':$even}">
                                    <td class=" ">{{params.size*(currentPage-1)+$index+1}}</a></td>
                                    <td class=" ">任务</a></td>
                                    <td class=" "><a ui-sref="home.taskDetail({task_id:item.task_id})"></a></td>
                                    <td class="center hidden-480 ">{{item.type_name}}</td>
                                    <td class="center hidden-480 ">{{item.total_money}}</td>
                                    <td class="center hidden-480 ">{{item.total_quantity}}</td>

                                    <td style="text-align: center" class="center hidden-480 ">{{item.time_interval}}</td>
                                    <td style="text-align: center" class="center hidden-480 ">
                                        <a ng-if="item.status != 2" ng-click="changeSysRPStatus(item.sys_red_packet_id,2)"><div>启用</div></a>
                                        <div ng-if="item.status == 2">已启用</div>
                                        <a ng-if="item.status == 2" ng-click="changeSysRPStatus(item.sys_red_packet_id,3)"><div>停用</div></a>
                                        <div ng-if="item.status != 2">已停用</div>
                                        <a><div ng-click="editor(item.sys_red_packet_id)">编辑</div></a>
                                        <a><div ng-click="delete(item.sys_red_packet_id)">删除</div></a>

                                    </td>
                                </tr>

                                </tbody>
                            </table>
                            <div class="row-fluid">
                                <div class="span6">
                                    <div class="dataTables_info" id="sample_1_info">当前 {{pageStart}} 到 {{pageEnd}} 共 {{count}} 条记录
                                    </div>
                                </div>
                                <div class="span6" style="text-align: center;width: 100%;">
                                    <div class="dataTables_paginate paging_bootstrap pagination">
                                        <pagination>
                                            <ul num-pages="numPages" current-page="currentPage"
                                                on-select-page="selectPage(page)">
                                                <li class="prev" ng-class="{disabled: noPrevious()}"><a
                                                        ng-click="selectPrevious()">&laquo; </a>
                                                </li>
                                                <li ng-if="judge(page,$index)" ng-repeat="page in pages" ng-class="{active: isActive(page)}"><a
                                                        ng-click="selectPage(page)" ng-if="!point[$index]">{{page}}</a> <span ng-if="point[$index]">...</span></li>
                                                <li class="next" ng-class="{disabled: noNext()}"><a
                                                        ng-click="selectNext()"> &raquo; </a>
                                                </li>
                                            </ul>
                                        </pagination>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>


<div class="modal fade" id="addRPacketModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" style="width:850px">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"></button>
                <h4 class="modal-title" id="myModalLabel">创建系统红包</h4>
            </div>
            <div class="modal-body">
                <form class="form-horizontal">
                    <div class="control-group">
                        <label class="control-label" style="margin-top:10px">聊天室名称</label>
                        <div class="controls" style="margin-top:10px">
                            <input type="text"  ng-model="rPacket.roomId"  >
                        </div>
                        <label class="control-label" style="margin-top:10px">红包类型</label>
                        <div class="controls" style="margin-top:10px">

                            <select
                                    ng-model="rPacket.rPacketType"
                                    ng-options="o.typeId as o.typeName for o in rPacketType"
                                    style=" background-color: transparent; border: 1px solid #dddddd; ">
                            </select>
                        </div>
                        <label class="control-label" style="margin-top:10px">红包金额</label>
                        <div class="controls" style="margin-top:10px">
                            <input type="text"  ng-model="rPacket.totalMoney" placeholder="最多精确到分">
                        </div>
                        <label class="control-label" style="margin-top:10px">红包数量</label>
                        <div class="controls" style="margin-top:10px">
                            <input type="text"  ng-model="rPacket.totalQuantity" placeholder="必须填写整数" >
                        </div>
                        <label class="control-label" style="margin-top:10px">时间间隔</label>
                        <div class="controls" style="margin-top:10px">
                            <input type="text"  ng-model="rPacket.timeInterval" placeholder="必须填写整数">
                        </div>
                        <!--
                                                <label class="control-label" style="margin-top:10px">创建子任务:</label>
                                                <table class="table table-bordered table-hover">
                                                    <thead>
                                                    <tr>

                                                        <th style="text-align: center;">任务名称</th>
                                                        <th style="text-align: center;">任务类型</th>
                                                        <th style="text-align: center;">金额</th>
                                                        <th style="text-align: center;">描述</th>
                                                        <th style="text-align: center;">任务链接</th>
                                                        <th style="text-align: center;">间隔</th>
                                                        <th style="text-align: center;">包名/分享标题</th>


                                                    </tr>
                                                    </thead>
                                                    <tr ng-if="task.taskItems.length > 0" ng-repeat='item in task.taskItems'>
                                                        <td style="text-align: center;"><input type="text" style="width:70px"  ng-model="item.taskItemName"></td>
                                                        &lt;!&ndash;<td style="text-align: center;"><input type="text" style="width:60px"  ng-model="item.taskItemtype"></td>&ndash;&gt;
                                                        <td>
                                                            <select
                                                                    ng-model="item.taskItemType"
                                                                    ng-options="o.typeId as o.typeName for o in taskItemType"
                                                                    style=" background-color: transparent; border: 1px solid #dddddd;width:100px; ">
                                                            </select>
                                                        </td>
                                                        <td style="text-align: center;"><input type="text" style="width:40px"  ng-model="item.taskItemMoney"></td>
                                                        <td style="text-align: center;"><input type="text" style="width:100px"  ng-model="item.describe"></td>
                                                        <td style="text-align: center;"><input type="text" style="width:100px"  ng-model="item.taskItemLink"></td>
                                                        <td style="text-align: center;"><input type="text" style="width:40px"  ng-model="item.openTimeInterval"></td>
                                                        <td style="text-align: center;"><input type="text" style="width:100px"  ng-model="item.packetName"><a ng-click="deleteTaskItem($index)">删除</a></td>

                                                    </tr>


                                                </table>
                                                <a ng-click="addTaskItem()"><img src="images/plus.jpg" style="width:40px" /></a>-->

                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                        <button type="button" class="btn btn-primary" ng-click="createRPacket()">添加</button>
                    </div>
                </form>
            </div>

        </div>
    </div>
</div>


<div class="modal fade" id="updateRPacketModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" style="width:850px">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"></button>
                <h4 class="modal-title" id="updateModalLabel">编辑系统红包</h4>
            </div>
            <div class="modal-body">
                <form class="form-horizontal">
                    <div class="control-group">
                        <label class="control-label" style="margin-top:10px">聊天室名称</label>
                        <div class="controls" style="margin-top:10px">
                            <input type="text"  ng-model="rPacket.room_id"  >
                        </div>

                        <!--<label class="control-label" style="margin-top:10px">红包类型</label>
                        <div class="controls" style="margin-top:10px">
                            <input type="text"  ng-model="rPacket.red_packet_type"  >
                        </div>-->
                        <label class="control-label" style="margin-top:10px">红包金额</label>
                        <div class="controls" style="margin-top:10px">
                            <input type="text"  ng-model="rPacket.total_money" placeholder="最多精确到分">
                        </div>
                        <label class="control-label" style="margin-top:10px">红包数量</label>
                        <div class="controls" style="margin-top:10px">
                            <input type="text"  ng-model="rPacket.total_quantity" placeholder="必须填写整数" >
                        </div>
                        <label class="control-label" style="margin-top:10px">时间间隔</label>
                        <div class="controls" style="margin-top:10px">
                            <input type="text"  ng-model="rPacket.time_interval" placeholder="必须填写整数">
                        </div>
                        <!--<label class="control-label" style="margin-top:10px">子任务数</label>
                        <div class="controls" style="margin-top:10px">
                            <input type="text"  ng-model="task.task_items_number" placeholder="必须填写整数">
                        </div>-->

                        <!--<label class="control-label" style="margin-top:10px">子任务列表:</label>
                        <table class="table table-bordered table-hover">
                            <thead>
                            <tr>

                                <th style="text-align: center;">任务名称</th>
                                <th style="text-align: center;">任务类型</th>
                                <th style="text-align: center;">金额</th>
                                <th style="text-align: center;">描述</th>
                                <th style="text-align: center;">任务链接</th>
                                <th style="text-align: center;">间隔</th>
                                <th style="text-align: center;">包名/分享标题</th>


                            </tr>
                            </thead>
                            <tr ng-if="task.childTask.length > 0" ng-repeat='item in task.childTask'>
                                <td style="text-align: center;"><input type="text" style="width:70px"  ng-model="item.task_item_name"></td>
                                &lt;!&ndash;<td style="text-align: center;"><input type="text" style="width:60px"  ng-model="item.taskItemtype"></td>&ndash;&gt;
                                <td>
                                    <select
                                            ng-model="item.task_item_type"
                                            ng-options="o.typeId as o.typeName for o in taskItemType"
                                            style=" background-color: transparent; border: 1px solid #dddddd;width:100px; ">
                                    </select>
                                </td>
                                <td style="text-align: center;"><input type="text" style="width:40px"  ng-model="item.task_item_money"></td>
                                <td style="text-align: center;"><input type="text" style="width:100px"  ng-model="item.task_item_describe"></td>
                                <td style="text-align: center;"><input type="text" style="width:100px"  ng-model="item.task_item_link"></td>
                                <td style="text-align: center;"><input type="text" style="width:40px"  ng-model="item.open_time_interval"></td>
                                <td ng-if="item.task_item_type != 2" style="text-align: center;"><input type="text" style="width:100px"  ng-model="item.packet_name"><a ng-click=""></a></td>
                                <td ng-if="item.task_item_type == 2" style="text-align: center;"><input type="text" style="width:100px"  ng-model="item.share_title"><a ng-click=""></a></td>

                            </tr>


                        </table>
                        <a ng-click="addTaskItem()"><img src="images/plus.jpg" style="width:40px" /></a>-->

                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                        <button type="button" class="btn btn-primary" ng-click="updateRPacket(rPacket)">确认修改</button>
                    </div>
                </form>
            </div>

        </div>
    </div>
</div>

